package com.itheima.changeparamal;

public class ChangeParaDemo {
    public static void main(String[] args) {
        int[] ints1=new int[]{1,2,3,4,5};
        int[] ints2=new int[]{1,2,3,4,5,6};
        int[] ints3=new int[]{1,2,3,4,5,7,8};
        System.out.println(sum(ints1));
        System.out.println(sum(ints2));
        System.out.println(sum(ints3));


    }

    private static int sum(int... ints) {
        int sum=0;
        for (int anInt : ints) {
            sum+=anInt;
        }
        return sum;
    }
}
